<?php session_start(); ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/bootstrap.css" type="text/css">
</head>
<body>
	<div class="row">
		<div class ="span9 ">
			<form action="index.php" method="post">
			Name: <input type="text" name="fname" />
			Password: <input type="password" name="pass" />
			<input type="submit" name ="login" />
			</form>
			<form action="index.php" method="post">
			<?php unset($_SESSION['login']);?>
			<input type="submit" name ="logout" />
			</form>
		</div>
	</div>
<?php

if(isset($_COOKIE["login"]))
{?>
	Welcome <?php echo $_COOKIE["login"]; ?>!<br />
<?php

}

if(isset($_POST['pass']))
{
$_SESSION['login']=$_POST["fname"];
}
if(isset($_SESSION['login']))
{
 echo $_SESSION['login'];
 setcookie("login", $_SESSION['login'], time()+3600);
}
?>

</body>
</html>